home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 06 General Architectures / 06 Rabin / time.h < prev   
Encoding:
C/C++ Source or Header  |  2001-12-10  |  1003 b   |  49 lines

  1. /* Copyright (C) Steve Rabin, 2001. 
  2.  * All rights reserved worldwide.
  3.  *
  4.  * This software is provided "as is" without express or implied
  5.  * warranties. You may freely copy and compile this source into
  6.  * applications you distribute provided that the copyright text
  7.  * below is included in the resulting source code, for example:
  8.  * "Portions Copyright (C) Steve Rabin, 2001"
  9.  */
  10.  
  11. #ifndef __TIME_H__
  12. #define __TIME_H__
  13.  
  14. #include "singleton.h"
  15.  
  16.  
  17. class Time : public Singleton <Time>
  18. {
  19. public:
  20.  
  21.     Time( void );
  22.     ~Time( void ) {}
  23.  
  24.     void MarkTimeThisTick( void );
  25.     float GetElapsedTime( void )                { return( m_TimeLastTick ); }
  26.     float GetCurTime( void )                    { return( m_CurrentTime ); }
  27.  
  28.     void SetGameSpeed( float value );
  29.     float GetGameSpeed( void )                    { return( m_GameSpeed ); }
  30.  
  31.  
  32. private:
  33.  
  34.     float m_StartTime;
  35.     float m_CurrentTime;
  36.     float m_TimeLastTick;
  37.     float m_GameSpeed;
  38.  
  39.     unsigned int GetExactTimeInMilliseconds( void );
  40.  
  41. };
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. #endif    // __TIME_H__